import React, { useState } from "react";
import Footer from "./components/footer/footer";
import { useHistory, Redirect, Route } from "react-router-dom";
// 路由拦截
import PrivateRoute from "./components/privateRoute";

import Home from "./pages/home/home"; //首页
import Attention from "./pages/attention/attention"; //关注
import Tmalllive from "./pages/Tmalllive/Tmalllive"; //逛超市
import ShoppingKa from "./pages/shoppingka/shoppingka"; //超市卡
import My from "./pages/my/my"; //我的
import messageBox from "./pages/home/messagebox/messagebox"; //我的
import SettingUp from "./pages/my/settingup/settingup"; //我的/设置
import Login from "./pages/my/login/login"; //登录
import Register from "./pages/my/register/register"; //注册

function App() {
  const { push } = useHistory();
  return (
    <div className="App">
      <Redirect from="/" to="home" />
      {/* 首页 */}

      <Route path="/home" component={Home} />
      {/*关注  */}
      <Route path="/attention" component={Attention} />
      {/* 天猫直播 */}
      <Route path="/goshopping" component={Tmalllive} />
      {/* 购物车 */}
      <Route path="/shoppingka" component={ShoppingKa} />
      {/* 我的 */}
      <Route path="/my" component={My} />
      {/* 消息盒子 */}
      <Route path="/messagebox" component={messageBox} />
      {/* 我的设置 */}
      <Route path="/settingup" component={SettingUp} />
      {/* 登录 */}
      <Route path="/login" component={Login} />
      {/* 注册 */}
      <Route path="/register" component={Register} />

      <Footer push={push} />
    </div>
  );
}

export default App;
